package com.xdf.whiteaccount.controller;

import com.xdf.whiteaccount.entity.CarryForward;
import com.xdf.whiteaccount.entity.Receivables;
import com.xdf.whiteaccount.entity.ResponseResult;
import com.xdf.whiteaccount.service.ConfigSQLBalanceService;
import org.apache.shiro.authz.annotation.RequiresUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/sqlBalance")
public class ConfigSQLBalanceController {
    @Autowired
    private ConfigSQLBalanceService configSQLBalanceService;

    /**
     * @Description :查询结转仓库的余额
     * []
     * @Return : java.util.List<account.entity.GConfigOneint>
     * @Author : Zk
     * @Date : 2019/12/10 10:44*/
    @RequestMapping(value = "/balanceForwary", method = RequestMethod.POST)
    @RequiresUser
    public CarryForward balanceForwary() throws Exception {
        CarryForward carryForward = configSQLBalanceService.balanceForwary();
        return carryForward;
    }

    /**
     * 备份数据库
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/backups", method = {RequestMethod.GET, RequestMethod.POST})
    @RequiresUser
    public ResponseResult<Void> backups() throws Exception {
        ResponseResult<Void> result = configSQLBalanceService.backups();
        return result;
    }

    /**
     * 恢复数据库
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/recover", method = {RequestMethod.GET, RequestMethod.POST})
    @RequiresUser
    public ResponseResult<Void> recover() throws Exception {
        ResponseResult<Void> result = configSQLBalanceService.recover();
        return result;
    }

    /**
     * @Description :备份数据库后结转
     * @Return : java.util.List<account.entity.GConfigOneint>
     * @Author : Zk
     * @Date : 2019/12/10 10:44
     */
    @RequestMapping(value = "/backupsAndbalance", method = {RequestMethod.GET, RequestMethod.POST})
    @RequiresUser
    public ResponseResult<Void> backupsAndbalance() throws Exception {
        ResponseResult<Void> result = configSQLBalanceService.backupsAndbalance();
        return result;
    }
}
